{% extends 'admin/layouts/base.html' %}

{% block title %}
<title>编辑焦点图</title>
{% endblock %}

{% block content %}
<form class="layui-form  layui-form-pane ui-form" method="post">
    <input type="hidden" name="id" value="{{ focus.id }}">
    <div class="layui-form-item">
        <label class="layui-form-label">选择角色</label>
        <div class="layui-input-inline">
            <select name="column_id" lay-verify="">
                {% if columns %}
                {% for column in columns %}
                <option value="{{ column.id }}" {% if column.id==focus.column_id %} selected {% endif %}>{{
                    column.html|safe
                    }}{{ column.title
                    }}
                </option>
                {% endfor %}
                {% endif %}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">焦点图标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" value="{{ focus.title }}" placeholder="请输入焦点图标题" lay-verify="required"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">简介</label>
        <div class="layui-input-block">
                <textarea name="label" placeholder="请输入简介"
                          class="layui-textarea ui-textarea">{{ focus.label }}</textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">外部链接</label>
        <div class="layui-input-block">
            <input type="text" name="link" value="{{ focus.link }}" lay-verify=""
                   autocomplete="off"
                   placeholder="请输入外部链接" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-upload">
            <div class="layui-upload-list">
                {% if focus.thumb_image %}
                <div class="upload-thumb-img">
                    <img src="{{ focus.thumb_image }}" lay-tips="单击删除">
                </div>
                {% else %}
                <div class="upload-thumb-img" style="display: none">
                </div>
                {% endif %}
            </div>
            <button type="button" class="layui-btn" id="upload-thumb"
                    upload-url="{{ url_for('upload.upload_thumb') }}" upload-type="images">
                上传缩略图
            </button>
        </div>
        <input type="hidden" name="thumb_image" class="layui-input input-upload" lay-verify="thumb_image"
               value="{{ focus.thumb_image }}">
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="text" name="level" lay-verify="required|number" placeholder="请输入排序数字" autocomplete="off"
                   value="{{ focus.level }}"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">新窗口打开</label>
        <div class="layui-input-block">
            <input type="checkbox" lay-verify="required" lay-filter="target" name="target" lay-skin="switch"
                   lay-text="是|否" {% if focus.target %} checked {% endif %} value="1">
        </div>
    </div>
    <div class="layui-form-item" pane>
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="checkbox" lay-verify="required" lay-filter="status" name="active"
                   title="激活" {% if focus.active %} checked {% endif %} value="1">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit="" lay-filter="app-form-submit" id="app-form-submit"
               value="提交" data-type="update">

    </div>
</form>
{% endblock %}

{% block js %}
<script src="{{ url_for('static',filename='admin/js/focus.js') }}"></script>
{% endblock %}